<?php
include_once "header.php";

$daftar_jenis = new Daftar_jenis();
$jenis = $daftar_jenis->getAll();

?>

<div id="container">
	<div id="maincont">
		<?php include_once "menu_samping.php"; ?>
		<div id="mainright">
			<div id="title">
			Jenis Surat Keluar
			</div>
			<div id="body">
			
			<br/>
			
			
			
			<table id="table2" cellspacing=0 cellpadding=4 width=100%>
				<tr>
					<th>No.</th>
					<th>Jenis Jenis Masuk</th>				
					<th></th>
				</tr>
				<?php
				$i=1;
				foreach($jenis as $Jenis){			
				?>
				<tr>
					<td><?php echo $i; ?></td>
					<td><?php echo $Jenis->getJenis(); ?></td>
					
					<td>
					<?php 
					echo "<a href=\"ubah_jenis_sk.php?kd_jenis_sk=".$Jenis->getId()."\">";
					echo "<img src=\"images/Text-Edit-icon.png\" alt=\"ubah\" title=\"ubah\" width=15px height=15px/></a> ";
					echo " ";
					
					echo "<a href=\"hapus_jenis_sk.php?kd_jenis_sk=".$Jenis->getId()."\" onclick=\"return del()\">";
					echo "<img src=\"images/delete-icon.png\" alt=\"hapus\" title=\"hapus\" width=15px height=15px/></a> ";
						
						
					
					?>
					</td>
				</tr>
				<?php $i++;} ?>
			</table>
			<?php
			if(empty($jenis)){
				echo "<table cellspacing=0 cellpadding=4 width=100%>";
				echo "<tr>";
				echo "<td>";
					echo "Data tidak tersedia.";	
				echo "</td>";			
				echo "</tr>";
				echo "</table>";
			}
			?>
			<br>
			<input type="button" value="Rekam" onClick="window.location.href='rekam_jenis_sk.php'">
			
			
					
			</div>
        </div>
	</div>
</div>
<?php
	include_once "footer.php";
?>

<script type="text/javascript">
	function del(){
	if(confirm('Apakah Anda yakin akan menghapus data ini?'))
	return true;
	else return false
	}
	
	$(function() { 
	$("#tgl").datepicker({dateFormat: "yy-mm-dd",
											buttonImage:'jquery/css/images/calendar.gif',
											buttonImageOnly: true,
											showOn: 'button'
	}); 
	});
	
	onload=function(){
	
		document.form.onreset=function(){
			window.location="jenis.php";
		}
	}
	
	function validasi(){
	var x = document.form.hal.value;
	var y = document.form.tgl.value;
	if (x=="" && y==""){
		alert('Isikan kata kunci terlebih dahulu!');
		return false;
	}
	}
</script>
